package com.cheyunkeji.er.view.auction;

import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.RelativeLayout;
import android.widget.TextView;


import com.cheyun.netsalev3.R;

import butterknife.BindView;
import butterknife.ButterKnife;

/** Created by Michael on 2017/2/20 20:38. */
public class ApplyStatusTextView extends RelativeLayout {

  @BindView(R.id.tv_apply_state)
  TextView tvApplyState;

  private View rootView;
  private Context context;

  public ApplyStatusTextView(Context context) {
    super(context);
    initView(context);
  }

  public ApplyStatusTextView(Context context, AttributeSet attrs) {
    super(context, attrs);
    initView(context);
  }

  public ApplyStatusTextView(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);
    initView(context);
  }

  private void initView(Context context) {
    this.context = context;
    rootView = LayoutInflater.from(context).inflate(R.layout.er_apply_status_layout, this, true);
    ButterKnife.bind(this, rootView);
  }

  public void setApplySuccessed() {
    tvApplyState.setText("已同意");
    tvApplyState.setBackgroundResource(R.drawable.shape_light_blue_bkg);
  }

  public void setApplyOnProcess() {
    tvApplyState.setText("已申请");
    tvApplyState.setBackgroundResource(R.drawable.shape_blue_bkg);
  }

  public void setApplyRefused() {
    tvApplyState.setText("已拒绝");
    tvApplyState.setBackgroundResource(R.drawable.shape_red_bkg);
  }

  public void setApplyIgnored() {
    tvApplyState.setText("已忽略");
    tvApplyState.setBackgroundResource(R.drawable.shape_dark_gray);
  }
}
